home *** CD-ROM | disk | FTP | other *** search
- Path: hal.COM!spike
- From: spike@hal.com (Spike White)
- Newsgroups: comp.lang.apl,comp.lang.asm.x86,comp.lang.c,comp.lang.c++,comp.os.ms-windows.programmer.networks
- Subject: Re: API Call to Acquire Ethernet Address
- Followup-To: comp.lang.apl,comp.lang.asm.x86,comp.lang.c,comp.lang.c++,comp.os.ms-windows.programmer.networks
- Date: 22 Feb 1996 15:35:12 GMT
- Organization: HAL Computer Systems, Inc.
- Message-ID: <4gi2fg$bcq@news.hal.com>
- References: <4f0bml$lvd@noc.tor.hookup.net> <4fnm1j$52@ns2.emirates.net.ae>
- NNTP-Posting-Host: zarathustra.hal.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Kannan (kannan@emirates.net.ae) wrote:
- : patrick@xiris.com (Patrick Whittle) wrote:
-
- : >I need access to an API call that will return the
- : >ethernet address from a NIC. Many programs and
- : >utilities I have used display the ethernet address
- : >such as "arp -a" from the TCP/IP protocol siute.
-
- : I too am interested in such a API call. please post it in this ng.
-
- Good luck! I had to write such a function on various UNIX system we
- ported to. I was hoping for something analogous to
- gethostname()/gethostaddr(), but no such luck. Which is weird, because
- I see a ether_ntoa() which is analogous to inet_ntoa().
-
- Altogether, it's about 400 lines of code since it must be done different
- ways on different platforms. For platforms that support a DLPI interface
- to the ethernet h/w, it's reasonably portable. But quite low-level --
- putting and getting STREAMS msgs.
-
- My favorite way to do it is on Solaris. On that OS (& apparently *only*
- on that OS), you can do a system("ifconfig -a") and parse the output. It'll
- give the ethernet address of all interfaces. It only does this as root,
- though.
-
- If you find any simple _portable_ way to do it, I'd be extremely interested.
- And if you find an easy way to do it in Windows, I'd be interested in that
- also.
-
- --
- Spike White | spike@hal.com | Biker Nerds
- HaL Software Systems | '87 BMW K75S, DoD #1347 | From HaL
- Austin, TX | http://www.halsoft.com/users/spike/index.html
- Disclaimer: HaL, want me to speak for you? No, Dave...
-